package com.genius.reservation.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.genius.reservation.common.BaseDao.BaseDao;
import com.genius.reservation.common.ResponseRule;
import com.genius.reservation.reservation.entity.ReservationInformation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.genius.reservation.user.entity.UserInformation;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 预约信息 Mapper 接口
 * </p>
 *
 * @author baomidou
 * @since 2022-05-26
 */
public interface ReservationInformationMapper extends BaseDao<ReservationInformation> {

    default ReservationInformation getOne(String reservationNumber){
        LambdaQueryWrapper<ReservationInformation> eq = this.getQueryWrapper().eq(ReservationInformation::getReservationNumber, reservationNumber);
        return this.selectOne(eq);
    }


    List<ReservationInformation> getAllReservation();
    default LambdaQueryWrapper<UserInformation> getWrapper(){
        return new LambdaQueryWrapper();
    }

    ReservationInformation selectOneById(@Param("reservationNumber")String reservationNumber);

    List<ReservationInformation> selectOneByDriver(@Param("driverNumber")String driverNumber);
    List<ReservationInformation> selectOneBySupplier(@Param("supplierNumber")String supplierNumber);
    List<ReservationInformation> selectOneByReceiver(@Param("receiverNumber")String receiverNumber);

    List<ReservationInformation> getAllReservationFiveByDriver(@Param("driverNumber")String driverNumber);
    List<ReservationInformation> getAllReservationFiveBySupplier(@Param("supplierNumber")String supplierNumber);
    List<ReservationInformation> getAllReservationFiveByReceiver(@Param("receiverNumber")String receiverNumber);
    List<ReservationInformation> getIncompleteReservationByReceiver(@Param("receiverNumber")String receiverNumber);

    List<ReservationInformation> getOneByOrder(@Param("orderNumber")String orderNumber);

    //首页需要使用
    List<ReservationInformation> getCompleteReservation();
    List<ReservationInformation> getUncompleteReservation();
    List<ReservationInformation> getLateReservationByReceiver();
    List<ReservationInformation> getUnlateReservationByReceiver();

    List<ReservationInformation> getConfirmReservation();
//    List<ReservationInformation> getReceivingReservation();
//    List<ReservationInformation> getReceivedReservation();
//    List<ReservationInformation> getReceiveErr();
//    List<ReservationInformation> getReservationErr();

    List<ReservationInformation> searchTable(@Param("whereKey")String whereKey,@Param("whereValue")String whereValue);

}
